class HomeController < ApplicationController
  
  def index
    if !params[:url].blank?
      @short_url = ShortUrl.find_by_url(params[:url])
      unless @short_url
        @short_url = ShortUrl.new( :url => params[:url] )
        @short_url.save
      end
    else
      params["url"] = "http://www.func09.com/wordpress/"
    end
  end

  def decomp
    @short_url = ShortUrl.find_by_code( params[:code] )
    unless @short_url
      redirect_to root_url
    end
  end

end
